package com.cvs.service.impl;

import com.cvs.bean.JiFenGood;
import com.cvs.dao.JiFenGoodMapper;
import com.cvs.service.JiFenGoodService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service("jiFenGoodService")
public class JiFenGoodServiceImpl implements JiFenGoodService {
    @Autowired
    private JiFenGoodMapper jiFenGoodMapper;
    @Override
    public List<JiFenGood> findAll() {
        return jiFenGoodMapper.findAll();
    }

    @Override
    public PageInfo<JiFenGood> findAllByPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);//开始分页
       List<JiFenGood> jiFenGoods=jiFenGoodMapper.findAllByPage();//调用mapper
        PageInfo pageInfo=new PageInfo(jiFenGoods);//数据库数据进行封装
       return pageInfo;
    }

    @Override
    public JiFenGood findOne(int id) {
        return jiFenGoodMapper.findOne(id);
    }

    @Override
    public JiFenGood findOneGoodInfo(int id) {
        return jiFenGoodMapper.findOneGoodInfo(id);
    }

    @Override
    public int updateJiFenGood(JiFenGood jiFenGood) {
        return jiFenGoodMapper.updateJiFenGood(jiFenGood);
    }
}
